import java.util.*;
public class Main {


    // 注意类名必须为 Main, 不要有任何 package xxx 信息
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder str = new StringBuilder(scanner.nextLine());
        for(int i = 0;i<str.length();) {
            int len = str.length();
             if(str.charAt(i) == str.charAt(i+1)) {
                str.replace(i,i+2,"");
                i=i-1<0?0:i-1;
            }else {
                 i++;
             }
        }
        if(str.length() == 0) {
            System.out.println(0);
        }else {
            System.out.println(str);
        }
    }

    public boolean isSubsequence (String S, String T) {
        int[] hash = new int[128];
        for(int i = 0;i<S.length();i++) {
            hash[S.charAt(i)]++;
        }
        for(int i = 0;i<T.length();i++) {
            if(hash[T.charAt(i)]!=0) {
                hash[T.charAt(i)]--;
            }
        }
        for(int i = 0;i<=128;i++) {
            if(hash[i]!=0) {
                return false;
            }
        }
        return true;
    }
}
